-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[beam] add toast notification component #177
Conversation
common/changes/@stonecrop/beam/feat-beam-toast-notify_2024-10-28-18-12.json
Show resolved
Hide resolved
examples/beam/default.story.vue
Outdated
const toast = useToast() | ||
const toastType = ref('default') | ||
const toastTime = ref(3) | ||
const toastMsg = ref('Toast Message.') | ||
const toastPosition = ref('top') | ||
|
||
const showNotification = () => { | ||
let toastOptions = { | ||
message: toastMsg.value, | ||
position: toastPosition.value, | ||
duration: toastTime.value * 1000, | ||
type: toastType.value, | ||
} | ||
// let notification = toast.success("Notified!", toastOptions) | ||
let notification = toast.open(toastOptions) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@crabinak @agritheory Should we create a wrapper around vue-toast-notification
so that users can import it from @stonecrop/beam
rather than having to remember to use the third-party library? Maybe we package the custom styles into our composable too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so I tried to create a composable wrapper around the dependency but there seems to be an issue with it that I can't locate the source of.
- If I keep the dependency in
examples
, then I get errors during the build but toasts still work inside the story so the errors are non-blocking.- Someone already raised an issue last month for the errors I saw but the author isn't interested in maintaining the project anymore.
- If I move the dependency to
beam
and try to create a re-usable composable, then the build fails entirely and I'm unable to access any of the Beam stories. I'm not sure what's going on there but this is blocking.
I think we'll have to either:
- look at another dependency
- somehow fix the existing dependency
- or recommend using the library manually in the target app (which kinda defeats the purpose of this PR)
What do you guys think?
@agritheory I added the toast notifications using vue-toast-notifications. I was able to override styling in the beam style sheet to align the colors with the Beam-defined ones. There are some controls on Histoire that will let you change a few settings in case you want to see it in a different position.
Let me know if this will work.